package dmqm.mall.controller;

import dmqm.mall.model.Order;
import dmqm.mall.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/order")
public class OrderController {
    @Autowired
    private OrderService orderService;

    @RequestMapping("/get/{id}")
    public Order GetOrder(@PathVariable int id){
        return orderService.Get(id);
    }

    public boolean AddOrder(@RequestBody Order order){
        return orderService.Add(order);
    }

    public boolean UpdateOrder(@RequestBody Order order){
        return orderService.Update(order);
    }

    public boolean DelOrder(@PathVariable int id){
        return orderService.Delete(id);
    }
}
